﻿#region License
// (c) Intergen.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
#endregion

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using TextGlow.Control.Utilities;

namespace TextGlow.Control.Controls.Document
{
  public class TableRowContainer : WrapPanel
  {
    //private Size CalcRowSize(UIElement element)
    //{
    //  TableRowControl row = (TableRowControl)element;

    //  double width = HasItemWidth ? ItemWidth : row.DesiredSize.Width;
    //  double height = HasItemHeight ? ItemHeight : row.MinHeight;

    //  return new Size(width, height);
    //}

    //protected override Size ArrangeOverride(Size finalSize)
    //{
    //  Lines = 0;

    //  int start = 0;
    //  double itemWidth = ItemWidth;
    //  double itemHeight = ItemHeight;
    //  double v = 0.0;
    //  double itemU = (IsHorizontal) ? itemWidth : itemHeight;
    //  UVSize size = new UVSize(Orientation);
    //  UVSize size2 = new UVSize(Orientation, finalSize.Width, finalSize.Height);
    //  bool flag = (!double.IsNaN(itemWidth) && itemWidth != 0);
    //  bool flag2 = (!double.IsNaN(itemHeight) && itemHeight != 0);
    //  bool useItemU = (IsHorizontal) ? flag : flag2;
    //  int end = 0;
    //  while (end < Children.Count)
    //  {
    //    UIElement element = Children[end];
    //    if (element != null)
    //    {
    //      UVSize size3 = new UVSize(Orientation, CalcRowSize(element));
    //      if ((size.U + size3.U).GreaterThan(size2.U))
    //      {
    //        if (!ArrangeLine(v, size.V, start, end, useItemU, itemU, size2.U - size.U))
    //          return finalSize;
    //        v += size.V;
    //        size = size3;
    //        if (size3.U.GreaterThan(size2.U))
    //        {
    //          if (!ArrangeLine(v, size3.V, end, ++end, useItemU, itemU, 0))
    //            return finalSize;
    //          v += size3.V;
    //          size = new UVSize(Orientation);
    //        }
    //        start = end;
    //      }
    //      else
    //      {
    //        size.U += size3.U;
    //        size.V = Math.Max(size3.V, size.V);
    //      }
    //    }
    //    end++;
    //  }
    //  if (start < Children.Count)
    //  {
    //    ArrangeLine(v, size.V, start, Children.Count, useItemU, itemU, size2.U - size.U);
    //  }
    //  return finalSize;
    //}
  }
}
